using System;
using System.Collections.Generic;
using CLELCore.Assembly.Descriptors;
using CLELCore.Assembly.Descriptors.ClassDescriptors;

namespace CLELCore.Assembly.BlobStreams.BlobInfo
{
	public class FieldBlobInfo
	{
		private FieldDescriptor _type;

		public FieldDescriptor Type
		{
			get
			{
				return _type;
			}
			set
			{
				_type = value;
			}
		}

		public FieldBlobInfo(byte [] blob,CLELAssembly assembly)
		{
			if(blob == null)
				throw new ArgumentException("Blob cannot be null");
			int start = 0;
			//parse blob length and ignore it
			Blob.DecompressBlobValue(blob,ref start);

			//skip field magic number
			start++;

			_type = new FieldDescriptor(ClassDescriptor.ParseFieldTypeFromBlob(assembly,blob,ref start));
		}
	}
}
